package part7;

/**
 * @author wcj
 * @Date 2021/5/15 14:40
 * @Version 1.0
 */
public class Part71 {

    private String userName;

    private Integer age;

    private Animal animal = new Animal("shanshan", 27);

    public static void main(String[] args) {
        Part71 part71 = new Part71();
        System.out.println(part71.animal);
    }

}

class Animal {

    private String name;

    private Integer age;

    public Animal(String name, Integer age) {
        this.name = name;
        this.age = age;
        System.out.println("name=" + name + ",age=" + age);
    }

    @Override
    public String toString() {
        return "Animal{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
